const theDatabase = require('../../config/db.js').theDb; //引入数据库
const sample_histogram_statistic_value_Schema = theDatabase.import('../../schema/sample_ground_histogram_statistic_value.js'); 
const sample_type2_statistic_value_Schema = theDatabase.import('../../schema/sample_type2_ground_statistic_value.js'); 
const sample_water_histogram_statistic_value = theDatabase.import('../../schema/sample_water_histogram_statistic_value.js'); 
const sample_type2_water_statistic_value = theDatabase.import('../../schema/sample_type2_water_statistic_value.js'); 

/**
 *刘千红
 *
 * @class echart_Compute_Update_Model
 */
class echart_Compute_Update_Model {
    /**
     *更新ground柱状图的数据库数据
     *
     * @static
     * @param {*} statistic_value
     * @param {*} point_num
     * @param {*} assess_type
     * @param {*} data
     * @returns
     * @memberof echart_Compute_Update_Model
     */
    static async UpdateElementData(statistic_value,point_num,assess_type,data){
        // console.log(111,typeof statistic_value,typeof point_num,assess_type,data)
    
            await sample_histogram_statistic_value_Schema.update(
                data
            ,{
                 where:{
                 statistic_value:statistic_value,
                 point_num:point_num,
                 assess_type:assess_type,
                  }
             })
        
       
        return true
    }
    
    /**
     *更新water柱状图的数据库数据
     *
     * @static
     * @param {*} statistic_value
     * @param {*} point_num
     * @param {*} assess_type
     * @param {*} data
     * @returns
     * @memberof echart_Compute_Update_Model
     */
    static async UpdateWaterElementData (statistic_value,point_num,assess_type,data){
        // console.log(111,typeof statistic_value,typeof point_num,assess_type,data)
    
            await sample_water_histogram_statistic_value.update(
                data
            ,{
                 where:{
                 statistic_value:statistic_value,
                 point_num:point_num,
                 assess_type:assess_type,
                  }
             })
        
       
        return true
    }
    
    
    /**
     *更新ground雷达图详细调查的数据库
     *
     * @static
     * @param {*} statistic_value
     * @param {*} point_num
     * @param {*} sample_depth
     * @param {*} data
     * @returns
     * @memberof echart_Compute_Update_Model
     */
    static async UpdateType2ElementEachDepthData(statistic_value,point_num,sample_depth,data){
        // console.log(111,statistic_value,point_num,sample_depth,data)
      
            await sample_type2_statistic_value_Schema.update(
                data
            ,{
                 where:{
                 statistic_value:statistic_value,
                 point_num:point_num,
                 sample_depth:sample_depth,
                  }
             })
        
       
        return true
    }
    
    /**
     *更新water雷达图详细调查的数据库
     *
     * @static
     * @param {*} statistic_value
     * @param {*} point_num
     * @param {*} sample_depth
     * @param {*} data
     * @returns
     * @memberof echart_Compute_Update_Model
     */
    static async UpdateType2WaterElementEachDepthData (statistic_value,point_num,sample_depth,data){
        // console.log(111,statistic_value,point_num,sample_depth,data)
      
            await sample_type2_water_statistic_value.update(
                data
            ,{
                 where:{
                 statistic_value:statistic_value,
                 point_num:point_num,
                 sample_depth:sample_depth,
                  }
             })
        
       
        return true
    }
    
    
}




module.exports = echart_Compute_Update_Model